#include <iostream>
using namespace std;



int main(){
	int input[5];
	for(int i=0;i<5;i++){
		cin >> input[i];
		int y = input[i]/3;
		input[i]=input[i]-(2*y);
		if     (i==4) {input[0]+=y;input[i-1]+=y;}
		else if(1==0) {input[4]+=y;input[i+1]+=y;}
		else   {input[i-1]+=y;input[i+1]+=y;}
	}
	for(int i=0;i<5;i++){
		printf("%5d",input[i]);
	}
}
